<template>
  <div>
    <dog-3
      v-for="(item, index) in arr"
      :key="index"
      :imgurl="item.dogImgUrl"
      :dogname="item.dogName"
      @love='fn'
    ></dog-3>
    <hr>
    <p>显示喜欢的狗：</p>
    <ul>
      <li v-for="(item,index) in loveArr" :key='index'>{{item}}</li>
    </ul>
  </div>
</template>

<script>
import Dog3 from "./components/practise/Dog3.vue";
export default {
  components: { Dog3 },
  data() {
    return {
      arr: [
        {
          dogImgUrl:
            "http://nwzimg.wezhan.cn/contents/sitefiles2029/10146688/images/21129958.jpg",
          dogName: "博美",
        },
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fci.xiaohongshu.com%2Fff2b81fc-f766-e381-2e23-5826657c4286%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fci.xiaohongshu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440765&t=120fd2976701243e2626233a95d2fc2d",
          dogName: "泰迪",
        },
        {
          dogImgUrl:
            "https://img2.baidu.com/it/u=3553205142,2486623901&fm=253&fmt=auto&app=138&f=JPEG?w=333&h=500",
          dogName: "金毛",
        },
        {
          dogImgUrl:
            "https://pic1.zhimg.com/80/v2-7ba4342e6fedb9c5f3726eb0888867da_1440w.jpg?source=1940ef5c",
          dogName: "哈士奇",
        },
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fcbu01.alicdn.com%2Fimg%2Fibank%2F2020%2F234%2F546%2F23243645432_682092133.220x220.jpg&refer=http%3A%2F%2Fcbu01.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440835&t=9bc64156373f87b4ae6b7ebb412ac9f9",
          dogName: "阿拉斯加",
        },
        {
          dogImgUrl:
            "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fww4.sinaimg.cn%2Fmw690%2F9f31b0f0ly1h5z5wwum17j20u013z4fj.jpg&refer=http%3A%2F%2Fwww.sina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1666440874&t=df4c944ade4edd2c179bc1c4aeadeead",
          dogName: "萨摩耶",
        },
      ],
      loveArr:[]
    };
  },
 methods: {
  fn(dogName){
    this.loveArr.push(dogName)
  }
 }
};
</script>

<style></style>
